import Vue from 'vue'
import VueRouter from 'vue-router'
import { Uploader } from 'vant';
import { Grid, GridItem,Image } from 'vant';

Vue.use(Grid);
Vue.use(GridItem);
Vue.use(VueRouter)
Vue.use(Uploader)
Vue.use(Image)

const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import(/* webpackChunkName: "home" */ '../views/HomeView.vue')
  },
  {
    path: '*',
    name: 'error_404',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/views/404View.vue')
  }
]

const router = new VueRouter({
  base: process.env.BASE_URL,
  routes
})
router.beforeEach((to, from, next) => {
  // if (!localStorage.getItem('xuhe-token')) {
  //   if (to.path == '/login' || to.path == '/register') {
  //     next();
  //   } else {
  //     next('/login');
  //   }
  // } else {
  //   next();
  // }
  next();

})
export default router
